/* ************************************************************************** */
/* Example of a syndication feed reader using the Project Rome API with */
/* BSF4ooRexx */
/* current version of Rome: rome1.0.jar https://rome.dev.java.net/ */
/* You need to implement this API plus the JDOM API */
/* jdom.jar , you can find this at https://jdom.org/ */
/* */
/* This example extents the funktion via BSF4ooRexx by using Java AWT */
/* to create a grafical user interface for inputting the feed URL */
/* created by Martin Stoppacher date: 26.12.2009 */
/* license:ÊÊÊÊLGPL 3.0ÊÊÊÊÊÊÊused versions: Java 1.6, ooRexx 4.0, Bsf4ooRexx */
/* (Lesser Gnu Public License version 3.0), */
/* cf. <http://www.gnu.org/licenses/lgpl.html> */
/* ************************************************************************** */
/* graphical part of the eaxample */
frame=.bsf~new("java.awt.Frame", "Please enter the url")
frame~bsf.addEventListener( 'window', 'windowClosing', 'call BSF "exit"')
frame~setLayout( .bsf~new("java.awt.FlowLayout") )
tf=.bsf~new("java.awt.TextField", "", 50)
frame~add(tf)
but=.bsf~new('java.awt.Button', 'retrieve feed')
frame~add(but)
but~bsf.addEventListener('action', '', ' call text tf ')
frame~~pack~~show~~toFront
do forever
INTERPRET .bsf~bsf.pollEventText
if result="SHUTDOWN, REXX !" then leave
end
exit
text: --procedure
use arg tf
say hello this reads a syndfeed
url= tf~getText /* you can use: "http://rss.orf.at/fm4.xml" */
/* this part is using the ROME API */
feedUrl=.bsf~new("java.net.URL", url)
say connecting__ || feedUrl~getAuthority()
call Syssleep 1
input=.bsf~new("com.sun.syndication.io.SyndFeedInput")
xmlr=.bsf~new("com.sun.syndication.io.XmlReader", feedUrl)
feed=input~build(xmlr)
--feed~setFeedType("rss_2.0") /* optional feed type setting */
say feed~getTitle()
say feed~getDescription()
say feed~getFeedType()
do forever
INTERPRET .bsf~bsf.pollEventText
end
::requires BSF.cls /* get the Java support */